package easy

func FindPoisonedDuration(timeSeries []int, duration int) int {
	cnt := 0
	for i := 0; i < len(timeSeries)-1; i++ {
		cnt += min(timeSeries[i+1]-timeSeries[i], duration)
	}
	return cnt + duration
}
